<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <cpn1></cpn1>
        <cpn1></cpn1>
        <cpn1></cpn1>
        <cpn1></cpn1>
    </div>

    <!-- 1.分离写法第一种方式 类型必须是:type="text/x-template" -->
    <!-- <script type="text/x-template" id="cpn">
        <div>
            <h1>我是标题1</h1>
            <span>我是span</span>
        </div>
    </script> -->

    <!-- 2.分离写法第二种方式 -->
    <template id="cpn">
        <div>
            <h1>我是标题1</h1>
            <span>我是span,哈啊哈哈哈</span>
        </div>
    </template>


    <script src='../js/vue.js'></script>
    <script>
        //1.注册一个全局组件
        Vue.component('cpn1', {
            template: '#cpn'
        })
        
        const app = new Vue({
            el: '#app'
        })
    </script>
</body>

</html>